﻿Imports QLPhuTungOto.Data
Imports QLPhuTungOto.Bus
Public Class frmThemLoaiPhuTung

    Dim LPT_BUS As New LoaiPhuTungBUS

    Private Sub btnHuy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHuy.Click
        Close()
    End Sub

    Private Sub ThemLoaiPhuTung()
        Dim loaiPhuTung As New LoaiPhuTung With {.TenLoaiPhuTung = txtTenLoaiPhuTung.Text}
        LPT_BUS.ThemLoaiPhuTung(loaiPhuTung)
    End Sub

    Private Sub btnThem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThem.Click

        If txtTenLoaiPhuTung.Text.Trim.Length <> 0 Then
            Try
                ThemLoaiPhuTung()
                TrangThai.ThayDoiLoaiPhuTung()
                Close()
            Catch ex As Exception
                MessageBox.Show("Không thể thêm loại phụ tùng", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
        End If

    End Sub
End Class